package com.iqiao.platform.dao;

import com.iqiao.common.base.BaseDao;
import com.iqiao.platform.model.Menu;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by flt on 2017/11/15.
 */
@Repository
public class MenuDao extends BaseDao<Menu, Long> {

    @Override
    public Class getEntityClass() {
        return this.getClass();
    }

    public List<Menu> findByRoleId(Long roleId) {
        return super.findList("findByRoleId", roleId);
    }

    public boolean exist(Long id) {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        return super.exist(params);
    }

    public boolean existByCode(String code) {
        Map<String, Object> params = new HashMap<>();
        params.put("code", code);
        return super.exist(params);
    }
}
